package com.feiyu.auth.util;

import java.util.Random;
import java.util.concurrent.ThreadLocalRandom;

/**
 * @author tang ming
 * @since 2021/12/11 18:40
 */
public class RandomUtil {
    public static char[] meta={'0','1','2','3','4','5','6','7','8','9'};

    public static String generate(int len){
        ThreadLocalRandom random = ThreadLocalRandom.current();
        StringBuilder res = new StringBuilder();
        while (len>0){
            int i= random.nextInt(meta.length);
            res.append(meta[i]);
            len--;
        }
        return res.toString();
    }
}
